package org.jumiz.javafx.business;

import org.jumiz.javafx.business.config.JpaConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class ApplicationContext {

    private static AnnotationConfigApplicationContext context;

    public static synchronized void init() {
        if (context == null) {
            context = new AnnotationConfigApplicationContext(JpaConfig.class);
        }
    }

    public static <T> T getBean(Class<T> tClass) {
        return context.getBean(tClass);
    }

}
